package qunar;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

public class CouponServiceFactory {

    private static Map<ProductSource,CouponService> serviceFactory = new HashMap<>();

    public static void register(ProductSource source, CouponService couponService){
        serviceFactory.put(source,couponService);
    }

    public static CouponService getService(ProductSource productSource){
        return serviceFactory.getOrDefault(productSource, serviceFactory.get(ProductSource.QUNAR_CARD));
    }



}
